package com.msb.order.controller;

import com.msb.order.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class RestTemplateController {
    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/testRestTemplate/{userId}")
    public String getUser(@PathVariable Integer userId){
        String result = restTemplate.getForObject("http://msb-user:10001/user/" + userId, String.class);
        return result;
    }
}
